//
//  GRCertificationAction.m
//  YC_GRice
//
//  Created by LiuFeng on 2018/7/23.
//  Copyright © 2018年 YeCai. All rights reserved.
//

#import "GRCertificationAction.h"

@implementation GRCertificationAction


+ (void)identifyIDCardWithDirection:(BOOL)isFront IMGURL:(NSString *)url completionHandler:(RequestBlock)completionHandler {
    NSString *key   = isFront ? @"idCardFront" : @"idCardBack";
    NSString *urlstr = [NSString stringWithFormat:@"%@appraisal/IdCard",GRiceAPI];
    
    [RequestManager MembershipRequestWithURLString:urlstr Method:GR_POST Paramers:@{key : url} completionHandler:^(BOOL success, id responseObject, GRError *error) {
        completionHandler(success, responseObject, error);
    }];
}


+ (void)identifyBankCardWithIMGURL:(NSString *)url completionHandler:(RequestBlock)completionHandler {
    NSString *urlstr = [NSString stringWithFormat:@"%@baidu/ocr/bankCard",GRDeliveryAPI];

    [RequestManager TouristsRequestWithURLString:urlstr Method:GR_POST Paramers:@{@"url" : url} completionHandler:^(BOOL success, id responseObject, GRError *error) {
        completionHandler(success, responseObject, error);
    }];
}


+ (void)getALLCertificationStatus:(RequestBlock)completionHandler {
    NSString *url = [NSString stringWithFormat:@"%@appraisal",GRiceAPI];
    
    [RequestManager MembershipRequestWithURLString:url Method:GR_GET Paramers:nil completionHandler:^(BOOL success, id responseObject, GRError *error) {
        completionHandler(success, responseObject, error);
    }];
}


+ (void)submitPersonalCertification:(NSDictionary *)paramer completionHandler:(RequestBlock)completionHandler {
    NSString *url = [NSString stringWithFormat:@"%@appraisal/addAppraisal",GRiceAPI];

    [RequestManager MembershipRequestWithURLString:url Method:GR_POST Paramers:paramer completionHandler:^(BOOL success, id responseObject, GRError *error) {
        completionHandler(success, responseObject, error);
    }];
}

+ (void)addAnEmergencyContact:(NSDictionary *)paramer completionHandler:(RequestBlock)completionHandler {
    NSString *url = [NSString stringWithFormat:@"%@appraisal/contacts",GRiceAPI];
    
    [RequestManager MembershipRequestWithURLString:url Method:GR_POST Paramers:paramer completionHandler:^(BOOL success, id responseObject, GRError *error) {
        completionHandler(success, responseObject, error);
    }];
}


+ (void)getALLContacts:(RequestBlock)completionHandler {
    NSString *url = [NSString stringWithFormat:@"%@appraisal/findContacts",GRiceAPI];
    
    [RequestManager MembershipRequestWithURLString:url Method:GR_GET Paramers:nil completionHandler:^(BOOL success, id responseObject, GRError *error) {
        if (success) {
            completionHandler(YES, responseObject, nil);
        }else {
            completionHandler(NO, nil, error);
        }
    }];
}


+ (void)getPersonalCertificationInfomation:(RequestBlock)completionHandler {
    NSString *url = [NSString stringWithFormat:@"%@appraisal/findAppraisal",GRiceAPI];
    
    [RequestManager MembershipRequestWithURLString:url Method:GR_GET Paramers:nil completionHandler:^(BOOL success, id responseObject, GRError *error) {
        completionHandler(success, responseObject, error);
    }];
}


@end
